package com.sensoro.study.io;

import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.nio.charset.StandardCharsets;

public class StreamStudy {

    public static void main(String[] args) {

        String content = "鹅鹅鹅，曲项向天歌，白毛浮绿水，红掌拨清波";
        try (var in = new ByteArrayInputStream(content.getBytes(StandardCharsets.UTF_8))){
            var os = new ByteArrayOutputStream();
            in.transferTo(os);
            System.out.println(os);
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}
